home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 3.2 KB | 87 lines | [TEXT/MPS ] |
- #
- # File: Arbitrator.vulib
- #
- # Contains: The tool definition along with the high level tasks to access
- # the tool's services
- #
- # The basic rules of operation are:
- # 1) The list of names is a global variable that persists until the
- # application is quit and re-launched.
- # 2) A specific name can occur only once in the list.
- # 3) If a name exists, it is locked by definition. At the time it is
- # locked, an object containing it is created and added to the list.
- # 4) If a name does not exist, it is unlocked by definition. When a
- # locked name is unlocked, its object is deleted from the list.
- # 5) Trying to lock a locked name fails.
- # 6) Trying to unlock a name fails if it is not locked already
- #
- # Written by: SBR from FileTool by P. Nagarajan
- #
- # Copyright: © 1993-1997 by Apple Computer, Inc., all rights reserved.
- #
- # Change History (most recent first):
- #
- #
- # 1.0.0 01/29/97 JAS Added 'vers' resources to library.
- # These should always match tool version when tool is revved.
- # 01/29/97 JAS Removed unsupported services
- # 11/03/94 SBR Added ThreadedService support
- # 09/29/94 SBR Built with LockName service
- # 03/26/93 NAGA xxx put comment here xxx
- #
- # To Do:
- #
-
- tool Arbitrator s:'Arbi'
- begin
- # Services specific to Arbitrator:
-
- # To lock a name
-
- Service "LockID"( 'list', 'undefined', 'undefined' ) return 'undefined';
-
- # first parameter is the 1-63 character name to lock as a semaphore
- # second parameter is Boolean: true means lock, false means unlock
- # third parameter is optional 1-63 character key string to lock/unlock the name
- # return value is Boolean, true means success, false means failure
-
-
- Service "AutoDestruct"( ) return 'undefined';
-
- # no parameters; always call this service asynchronously; activates when canceled;
- # unregisters all keys with its AutoDestructID (asynchronous job ID).
- # return value is Boolean, true means success, false means failure
-
-
- Service "DumpIDs"( ) return 'list';
-
- # no parameters; used for debugging.
- # return value is list:
- # { 'IDs', {semaphore...}, {semaphore2}, {semaphore1}}
-
-
-
- # Generic services:
-
- # To Echo a list after a number of ticks, in a new thread
- Service "EchoThread"( 'undefined', 'integer', 'symbol', 'integer' ) return 'undefined';
- # first parameter is the value or list of values to echo
- # second parameter is the number of ticks to pause before returning
- # third parameter is Boolean:
- # true means beep entering and leaving ProcessRequest()
- # false means do not
- # return value should be equal to first parameter except when:
- # symbol and descriptor parameters are turned into strings by VU
- # integers are sent to the tool as long or short based on VU version
- # longs are sent to the script as long or string based on VU version
-
- # To Echo a list after a number of ticks, in the RequestDispatcher thread
- Service "EchoNoThread"( 'undefined', 'integer', 'symbol', 'integer' ) return 'undefined';
- # same as Echo service except this one is non-threaded
-
- # To set the number of ticks given to WaitNextEvent() in the tool
- # Only affects the tool when it is in the background
- # returns the previous value
- Service "SetSleepTicks"( 'integer' ) return 'integer';
-
- end;